package com.dong.c09_netty_unpooled;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
 * <h1></h1>
 *
 * @author : dzj
 * @create: 2021-03-08 18:47
 */
public class ByteBuf01 {
    /**
     * netty buffer 不需要flip进行翻转: 底层维护了ReaderIndex & writerIndex
     * @param args
     */
    public static void main(String[] args) {
        ByteBuf buffer = Unpooled.buffer(10);
        for (int i = 0; i < 10; i++) {
            buffer.writeByte(i);
        }
        for (int i = 0; i < buffer.capacity(); i++) {
            byte aByte = buffer.getByte(i);
            System.out.println(aByte);
        }
    }
}
